<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1,user-scalable=no,shrink-to-fit=no,minimal-ui">
		<title>民政局工餐预定系统-管理后台</title>
		<style type="text/css">
			* {margin: 0;padding: 0;}
			body {font-family: "微软雅黑";font-size: 14px;}
			header {width: 100%;height: 60px;background-color: #fff;}
			header .container {width: 1170px;height: 60px;line-height: 60px;margin: 0 auto;}
			header h3 {font-weight: normal;}
			main {width: 100%;height: 150px;background-color: #50D1BB;box-shadow: inset 0px 0px 10px #42A392;position: relative;}
			main .container {display: inline-block;position: absolute;bottom: 0;left: 50%;transform: translate(-50%,70%);z-index: 1;background-color: #fff;box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);padding: 50px;border-radius: 6px;width: 350px;}
			main .container form {width: 100%;}
			main .container form .form-item {width: 100%;}
			main .container form .form-item+.form-item {margin-top: 20px;}
			main .container form .form-item label {display: block;padding-bottom: 5px;}
			main .container form .form-item input {width: 100%;border: 1px solid #ccc;padding: 4px 6px;box-sizing: border-box;border-radius: 4px;}
			main .container form .form-item input:focus {box-shadow: none;outline: none;border-color: rgba(82, 168, 236, 0.8);}
			main .container form .form-item input[type="button"] {padding: 10px 0;border-color: rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.15) rgba(0, 0, 0, 0.25);background-color: #f5f5f5;cursor: pointer;}
		</style>
		<!--[if lt IE 9]>
			<script src="__PUBLIC__/js/html5shiv.min.js" type="text/javascript" charset="utf-8"></script>
		<![endif]-->
	</head>

	<body>
		<header>
			<div class="container">
				<h3><strong>管理后台</strong>&nbsp;&nbsp;&nbsp;民政局工餐预定系统</h3>
			</div>
		</header>
		<main>
			<div class="container">
				<form action="" method="post">
					<div class="form-item">
						<label>管理账号</label>
						<input type="text" name="username" placeholder="admin" value="{$Think.cookie.adminname}" />
					</div>
					<div class="form-item">
						<label>管理密码</label>
						<input type="password" name="password" placeholder="password" value="{$Think.cookie.password}" />
					</div>
					<div class="form-item">
						<input style="width: auto;" type="checkbox" id="1" name="remember" value="1" />
						<label style="display: inline;" for="1">两周内自动登录</label>
					</div>
					<div class="form-item">
						<input type="button" onclick="onLogin()" value="登录" />
					</div>
				</form>
			</div>
		</main>
	</body>

</html>
<script src="__PUBLIC__/js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	function onLogin() {
		var form = $("form")[0];
		var formData = new FormData(form);
		$.ajax({
			type: "post",
			url: "{:U('ajax_login')}",
			data: formData,
			async: true,
			cache: false,
			contentType: false,
			processData: false,
			success: function(data) {
				if(data == 200) {
		   			window.location.href = "../Index/index.html";
		   		}else if(data == 400) {
		   			alert("用户名不存在！");
		   		}else {
		   			alert("密码错误！");
		   		}
			}
		})
	}
</script>